//
//  CommonDef.h
//  EatNumber
//
//  Created by zg.shao on 14/12/19.
//  Copyright (c) 2014年 kuwo.cn. All rights reserved.
//

#ifndef EatNumber_CommonDef_h
#define EatNumber_CommonDef_h

// 设备的高和宽
#define     SCREEN_WIDTH    ([[UIScreen mainScreen] bounds].size.width)
#define     SCREEN_HEIGHT   ([[UIScreen mainScreen] bounds].size.height)

#define     SCREEN_MAX_LENGTH (MAX(SCREEN_WIDTH, SCREEN_HEIGHT))
#define     SCREEN_MIN_LENGTH (MIN(SCREEN_WIDTH, SCREEN_HEIGHT))

#define IS_IPAD     (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#define IS_IPHONE   (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
#define IS_RETINA   ([[UIScreen mainScreen] scale] >= 2.0)

#define IS_IPHONE_4_OR_LESS (IS_IPHONE && SCREEN_MAX_LENGTH < 568.0)
#define IS_IPHONE_5 (IS_IPHONE && SCREEN_MAX_LENGTH == 568.0)
#define IS_IPHONE_6 (IS_IPHONE && SCREEN_MAX_LENGTH == 667.0)
#define IS_IPHONE_6P (IS_IPHONE && SCREEN_MAX_LENGTH == 736.0)
#define IS_GREATER_IPHONE_5 (IS_IPHONE && SCREEN_MAX_LENGTH >= 568.0)

#define SYSTEM_VERSION_EQUAL_TO(v)                  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame)
#define SYSTEM_VERSION_GREATER_THAN(v)              ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending)
#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v)  ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN(v)                 ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
#define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v)     ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending)

#define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO_IOS8                 SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0")


//16进制颜色转换
#define COLOR_WITH_RGB(rgb) COLOR_WITH_RGBA(rgb, 1)

#define COLOR_WITH_RGBA(rgb, a) [UIColor colorWithRed:((float)((rgb & 0xFF0000) >> 16)) / 255.0 \
    green:((float)((rgb & 0xFF00) >> 8)) / 255.0 \
    blue:((float)((rgb & 0xFF))) / 255.0 \
    alpha:a]


// 恢复游戏的通知
#define RESTORE_GAME_NOTIFICATION           @"RestoreGameNotification"
#define UPDATE_SOUND_IMAGE_NOTIFICATION     @"UpdateSoundImageNotification"

// 各种ID
// 应用程序的id
#define APP_ID          @"956381571"

// 友盟的key
#define UMENG_APP_KEY   @"54a2405ffd98c541b6000407"

//AppID：wxad8f9a72e082f05f
//AppSecret：c13a87c437471627b20261aa50d404ac
#define WeiXinAppID     @"wxad8f9a72e082f05f"
#define WeiXinAppSecret @"c13a87c437471627b20261aa50d404ac"

// QQ
#define QQAppID         @"1104016832"
#define QQAppSecret     @"VcWhUjt37y4pxnHU"
#define QQApiSchema     @"tencent1104016832"

#define SHARE_LOGO  [UIImage imageNamed:@"shareLogo"]

#endif
